Spot instances¶
eksctl
has support for spot instances through the MixedInstancesPolicy for Auto Scaling Groups.
Here is an example of a nodegroup that uses 50% spot instances and 50% on demand instances:
nodeGroups:
- name: ng-1
minSize: 2
maxSize: 5
instancesDistribution:
maxPrice: 0.017
instanceTypes: ["t3.small", "t3.medium"] # At least one instance type should be specified
onDemandBaseCapacity: 0
onDemandPercentageAboveBaseCapacity: 50
spotInstancePools: 2
Note that the nodeGroups.X.instanceType
field shouldn't be set when using the instancesDistribution
field.
This example uses GPU instances:
nodeGroups:
- name: ng-gpu
instanceType: mixed
desiredCapacity: 1
instancesDistribution:
instanceTypes:
- p2.xlarge
- p2.8xlarge
- p2.16xlarge
maxPrice: 0.50
This example uses the capacity-optimized spot allocation strategy:
nodeGroups:
- name: ng-capacity-optimized
minSize: 2
maxSize: 5
instancesDistribution:
maxPrice: 0.017
instanceTypes: ["t3.small", "t3.medium"] # At least one instance type should be specified
onDemandBaseCapacity: 0
onDemandPercentageAboveBaseCapacity: 50
spotAllocationStrategy: "capacity-optimized"
Note that the spotInstancePools
field shouldn't be set when using the spotAllocationStrategy
field. If the spotAllocationStrategy
is not specified, EC2 will default to use the lowest-price
strategy.
Here is a minimal example:
nodeGroups:
- name: ng-1
instancesDistribution:
instanceTypes: ["t3.small", "t3.medium"] # At least one instance type should be specified
Parameters in instancesDistribution¶
Please see the config parameters for details.